home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / musik / MIDIFP21 / SOURCES / INCLUDE / NOTIMTAB.PIF < prev    next >
Encoding:
Text File  |  1996-08-23  |  2.7 KB  |  75 lines

  1. #include <midi.h>
  2.  
  3. /**************************************************************
  4. *
  5. *                NOTIMTAB.PIF
  6. *
  7. **************************************************************/
  8.  
  9. /******* access to note time table via the following structure *************/
  10.  
  11. typedef event NOTE ;
  12. #define _ON_    0x80        /* internal representation of "note on" */
  13. typedef long TIME ;
  14.  
  15. typedef struct 
  16. {
  17.     TIME time ;              /* absolute time of event (element) */
  18.     int reference ;          /* pointer to corresponding note on/off event */
  19.     unsigned char dynamic ;  /* note on dynamic or note off dynamic */
  20.     NOTE note ;              /* bit7 = 0 note off; bit7 = 1 note on */
  21.     unsigned char channel ;  /* origination channel of event */ 
  22. NOTE_TIME_TABLE_ELEMENT ;
  23.  
  24.  
  25. /********************************************************************
  26. */
  27.     unsigned int fill_note_time_table
  28.     (
  29.         unsigned char *track_address,            /* IN: pointer to a track in a MIDI file */
  30.         long track_length,                        /* IN: in bytes */
  31.         NOTE_TIME_TABLE_ELEMENT *first_element,    /* OUT: note time table */
  32.         long *elements_generated,                /* OUT: elems. filled into note time table */
  33.         unsigned int *channels,                    /* OUT: mask indicating non-empty channels */
  34.         NOTE *min_note, NOTE *max_note,            /* OUT: lowest and highest note of the track */
  35.         char *trackname,                        /* OUT: track name */
  36.         int max_text_length                        /* IN: max. length of track name */
  37.     ) ;
  38. /*
  39. *  Transforms the data of a 
  40. *  MIDI standard file into a fast access data structure for 
  41. *  further processing. 
  42. *  RETURN: 
  43. */
  44.     #define note_time_table_filled         10
  45.     #define wrong_event_found              11
  46.     #define data_without_status_given      12
  47.     #define next_data_overflow             13
  48.     #define no_var_length_number           14
  49. /* 
  50. ********************************************************************/
  51.  
  52.  
  53. /*******************************************************************
  54. */
  55.     NOTE_TIME_TABLE_ELEMENT *get_element
  56.     (
  57.         NOTE_TIME_TABLE_ELEMENT *first_element, /* IN: start position */
  58.         unsigned long number ,                    /* IN: number of elements after
  59.                                                    first element to look on */
  60.         TIME time                                /* IN: nominal time of element */
  61.     ) ;
  62. /*
  63. * Searches the one element in a note time table
  64. * which possesses a time that is as near as possible 
  65. * to the input time and higher than the input time.
  66. * The first element with this fewest possible or equal time
  67. * is returned if more elements have the same time.
  68. * RETURN:  pointer to the element found, or NULL (if only 
  69. *          elements with lower times exist in the specified range)
  70. *******************************************************************/    
  71.